<template>
	<view>
		<div class="app">
			<div class="topbar">
				<!-- 				<div class="item">
					<span>8</span>
					<span>全部</span>
				</div> -->
				<div class="item spect">
					<span>{{listNum}}</span>
					<span>已完成</span>
				</div>
				<!-- 				<div class="item">
					<span>7</span>
					<span>待评价</span>
				</div> -->
			</div>
			<view v-for="(item,index) in table" :key="index">
				<div class="cont">
					<div class="expressitem" @click="torderdetail">
						<image class="img"
							src="../../static/logo.png">
						</image>
						<div class="item-cont">
							<div class="inf1">
								<span class="name">{{item.userName}}</span>
								<span>{{item.userPhone}}</span>
								<span class="num">已完成</span>
							</div>
							<div class="inf2">
								<span>订单金额￥{{item.money}}</span>
								<span>{{item.orderTime}}</span>
							</div>
							<div class="inf4">
								<span>收货地址:</span>
								<span>{{item.comAddress}}</span>
								<uni-icons type="arrow-right" color="#95a5ac"></uni-icons>
								<span>{{item.userMapAddress}}</span>
							</div>
						</div>
					</div>
				</div>
			</view>
		</div>
	</view>
</template>

<script>
	import {
		baseUrl
	} from "../../libs/request.js"
	export default {
		data() {
			return {
				riderInfo: [],
				listNum: "",
				table: [],
			};
		},
		onLoad() {
			this.lookRiderOrder()
		},
		methods: {
			torderdetail() {
				uni.setStorageSync("userOrderTableComplete",this.table)
				uni.navigateTo({
					url: './orderdatail?data=1'
				});
			},
			lookRiderOrder() {
				let riderInfo = uni.getStorageSync("riderInfo")
				let riderId = riderInfo.riderid
				uni.request({
					url: baseUrl + "/riderOrder/riderOrderLookEnd",
					method: 'POST',
					data: {
						riderid: riderId,
					},
					header: {
						"Content-Type": "application/x-www-form-urlencoded"
					},
					success: (res) => {
						console.log(res)
						this.table = res.data.list
						// for(let i=0;i<this.table.length;i++){
						// 	this.table[i].comAddress = this.table[i].comAddress + "分店"
						// }
						this.listNum = res.data.listNum
					}
				})
			},

		}
	};
</script>

<style lang="scss">
	* {
		margin: 0;
		padding: 0;
	}

	.spect {
		background-color: #ffbd27 !important;
		padding: 5rpx;
		box-sizing: border-box;
		border-radius: 5px;
	}

	.app {
		background-color: #f2f2f2;
		height: 100vh;
		padding-top: 20rpx;

		.topbar {
			border-radius: 10px;
			width: 90%;
			background-color: #fff;
			display: flex;
			justify-content: space-around;
			padding: 10rpx;
			margin: 0 auto;
			color: #95a5ac;
			font-size: 14px;
			font-weight: 700;

			.item {
				display: flex;
				flex-direction: column;
				align-items: center;
			}
		}

		.cont {
			padding-left: 10rpx;
			padding-right: 10rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			.expressitem {
				width: 90%;
				display: flex;
				align-items: center;
				margin-top: 10px;
				border-bottom: 1px solid #d9dbeb;
				background-color: #ffffff;
				border-radius: 10px;
				padding: 15rpx;

				.img {
					width: 160rpx;
					height: 150rpx;
					border-radius: 4px;
				}

				.item-cont {
					margin-left: 10px;

					.inf1 {
						display: flex;
						align-items: center;
						font-size: 12px;

						.name {
							margin-right: 5px;
							font-weight: 700;
						}

						.num {
							margin-left: 20px;
							font-size: 12px;
							font-weight: 700;
							color: #ffbd27;
						}
					}

					.inf2 {
						margin-top: 5rpx;
						display: flex;
						color: #95a5ac;
						font-size: 10px;

						span {
							margin-right: 5px;
						}
					}

					.inf3 {
						.tag-right {
							margin-left: 10rpx;
						}
					}

					.inf4 {
						margin-top: 5rpx;
						display: flex;
						align-items: center;
						font-size: 10px;
						color: #95a5ac;
					}
				}
			}
		}
	}
</style>
